import React, { Component } from "react";
import { Form, Input, Select, Modal } from "antd";
const { TextArea } = Input;
class EditUserForm extends Component {
    render() {
        const { visible, onCancel, onOk, form, confirmLoading, currentRowData } = this.props;
        const { getFieldDecorator } = form;
        const { userId, openId, userPrivilege, userInfo, userDay } = currentRowData;
        const formItemLayout = {
            labelCol: {
                sm: { span: 4 },
            },
            wrapperCol: {
                sm: { span: 16 },
            },
        };
        console.log(currentRowData)
        return (
            <Modal
                title="编辑"
                visible={visible}
                onCancel={onCancel}
                onOk={onOk}
                confirmLoading={confirmLoading}
            >
                <Form {...formItemLayout}>
                    <Form.Item label="用户ID:">
                        {getFieldDecorator("userId", {
                            initialValue: userId,
                        })(<Input disabled />)}
                    </Form.Item>
                    <Form.Item label="openId:">
                        {getFieldDecorator("openId", {
                            initialValue: openId,
                        })(<Input disabled />)}
                    </Form.Item>
                    <Form.Item label="用户信息:">
                        {getFieldDecorator("userInfo", {
                            initialValue: userInfo,
                        })(<Input disabled />)}
                    </Form.Item>
                    <Form.Item label="创建时间:">
                        {getFieldDecorator("userDay", {
                            initialValue: userDay,
                        })(<Input disabled />)}
                    </Form.Item>
                    <Form.Item label="用户角色:">
                        {getFieldDecorator("userPrivilege", {
                            initialValue: userPrivilege,
                            rules: [{ required: true }],
                        })(
                            <Select style={{ width: 120 }} disabled={userId === "admin"}>
                                <Select.Option value="管理员">管理员</Select.Option>
                                <Select.Option value="普通用户">普通用户</Select.Option>
                            </Select>
                        )}
                    </Form.Item>
                </Form>
            </Modal>
        );
    }
}

export default Form.create({ name: "EditUserForm" })(EditUserForm);
